class Solution {
public:
    int temp[31] = {0};
    int fib(int n) {
        if (n == 1 || n == 0) {
            return n;
        }
        if (temp[n] != 0) {
            return temp[n];
        }
        temp[n] = fib(n - 1) + fib(n - 2);
        return temp[n];
    }
};